import pandas as pd
pd.set_option('display.unicode.east_asian_width',True)
df1 = pd.DataFrame({'year':['2020','2021','2022'],
                    'month':['1','6','12'],
                    'day':['1','30','31'],
                    'hour':['1','13','18'],
                    'minute':['1','14','30'],
                    'second':['1','0','0']})
df1['组合后的时间'] = pd.to_datetime(df1)
print('时间后的组合:\n',df1)
df2 = df1['组合后的时间']
df3 = pd.DataFrame()
df3 ['年'],df3['月'],df3['日']=df2.dt.year,df2.dt.month,df2.dt.day
df3 ['时'],df3['分'],df3['秒']=df2.dt.hour,df2.dt.minute,df2.dt.second
df3['星期'],df3['季度'] = df2.dt.weekday +1,df2.dt.quarter
df3['是否年底'],df3['是否月底'] =df2.dt.is_year_end,df2.dt.is_month_end
print('时间的提取:\n',df3)
